package cn.gok.homework;

import java.util.ArrayList;

class Pet{
    private String name;
    //脚的个数
    private int feetCount;

    @Override
    public String toString() {
        return "Pet{" +
                "name='" + name + '\'' +
                ", feetCount=" + feetCount +
                '}';
    }

    public Pet(String name, int feetCount) {
        this.name = name;
        this.feetCount = feetCount;
    }
}
class Family{
    //每个家庭可以养有多只宠物（使用什么样的集合去存储宠物？？）
    private String owner;
    private Pet pet;

    @Override
    public String toString() {
        return "Family{" +
                "owner='" + owner + '\'' +
                ", pet=" + pet +
                '}';
    }

    public Family(String owner, Pet pet) {
        this.owner = owner;
        this.pet = pet;
    }
}
public class 第三题 {
    public static void main(String[] args) {
        //创建2个family对象，分别拥有2只和3只宠物
        ArrayList<Family> families1 = new ArrayList<>();
        families1.add(new Family("陈1",new Pet("giao哥",2)));
        families1.add(new Family("陈1",new Pet("战神",2)));
        ArrayList<Family> families2 = new ArrayList<>();
        families2.add(new Family("陈2",new Pet("giao哥1",2)));
        families2.add(new Family("陈2",new Pet("giao哥2",2)));
        families2.add(new Family("陈2",new Pet("驴保国",4)));
//        System.out.println(families1);
//        System.out.println(families2);
    }
}
